package com.tasly.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tasly.dao.UserDao;
import com.tasly.model.entity.UserDO;
import com.tasly.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserDao, UserDO> implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public List<UserDO> selectList() {
        return userDao.selectList(null);
    }

    @Override
    public List<UserDO> selectListByName(UserDO user) {
        LambdaQueryWrapper<UserDO> userLambdaQueryWrapper = new LambdaQueryWrapper<>();
        userLambdaQueryWrapper.eq(UserDO::getName, user.getName());
        List<UserDO> users = userDao.selectList(userLambdaQueryWrapper);
        return users;
    }
}
